<script type="text/javascript">
    function checkAllList(){
       var theform = document.frmForm;
       var n = parseInt(theform.iCount.value);

       for(i=0; i<n; i++){
           if(theform.checkAll.checked){
           	  	document.getElementById("checkItem"+i).checked=true;
           }else{
           		document.getElementById("checkItem"+i).checked=false;
           }
       }
       return true;
    }

    function search(){
    	var theform = document.frmForm;
    	theform.submit();
    	return true;
    }

    function deleteAction(value){
    	var theform = document.frmForm;
    	theform.idValue.value = value;
    	theform.action = "<{$APPLICATION_URL}>/Admin/TemplatePhoto/delete";
    	theform.submit();
    	return true;
    }
</script>
<form method="post" action="<{$APPLICATION_URL}>/Admin/TemplatePhoto/index" name = "frmForm">
<div class="box">
	<div class="header">
		All Screenshot for template "<{$templateName}>"
		<div style="float:right"><a href="<{$APPLICATION_URL}>/Admin/TemplatePhoto/add/templateId/<{$templateId}>">Add New Screenshot</a></div>
	</div>
	<div class="body">
		<div class="panes">
				<table cellpadding="0" cellspacing="0" border="0" class="grid_table wf">
					<thead>
						<tr>
							<th width="10px">
								<div>
									<input name="checkAll" id = "checkAll" onclick="checkAllList(this);" type="checkbox" >
								</div>
							</th>
							<th width="10px">ID</th>
							<th width="120px">Screenshot</th>														
							<th width="200px">Title</th>
							<th>Main Photo</th>
							<th>Status</th>
							<th>Action</th>
						</tr>
					</thead>
					<tbody>
						<{assign var=i value=0}>
						<{foreach name=outer item=templatePhotoEntity from=$itemList}>
						<tr class="gradeX">
							<td>
								<div>
									<input name="checkItem<{$i}>" id="checkItem<{$i}>" value="<{$templatePhotoEntity->id}>" type="checkbox">
								</div>
							</td>
							<td><{$templatePhotoEntity->id}></td>							
							<td><img src="<{$templatePhotoEntity->getThumb()}>" width="150"></td>
							<td><{$templatePhotoEntity->title}></td>
							<td><{$templatePhotoEntity->title}></td>
							<td class="center">
								<div><{$templatePhotoEntity->getStatusName()}></div>
							</td>
							<td class="center">
								<div style="float: right;">
									<{if $mainPhotoId != $templatePhotoEntity->id}>
									<a href="<{$APPLICATION_URL}>/Admin/TemplatePhoto/setMain/id/<{$templatePhotoEntity->id}>/templateId/<{$templateId}>">
										Set Main Photo
									</a> 
									<{/if}>
									<a href="<{$APPLICATION_URL}>/Admin/TemplatePhoto/edit/id/<{$templatePhotoEntity->id}>/templateId/<{$templateId}>">
										<img src="<{$APPLICATION_URL}>/Themes/Default/Images/b_edit.png" alt="" />
									</a> 
									<a href="javascript:void(0);" onclick="if (confirm('Are you sure you want to delete this record?')) { deleteAction(<{$templatePhotoEntity->id}>); } else { return false; }" class="notboldText">
										<img src="<{$APPLICATION_URL}>/Themes/Default/Images/b_drop.png" alt="" />
									</a>
								</div>
							</td>
						</tr>
						<{assign var=i value=$i+1}>
						<{/foreach}>
						<tr>
							<td colspan="8">
								<input type="hidden" name="iCount" id="iCount" value="<{$i}>" />
								<input type="hidden" name="idValue" id="idValue" value="" />
								<input type="hidden" id="actionForm" name="actionForm" value="">
								<input type="hidden" id="actionKey" name="actionKey" value="<{$actionKey}>">
								<div style="float: right;">
									<input name="inactive" value=" Inactive" onclick="javascript: var theform = document.frmForm; theform.action = '<{$APPLICATION_URL}>/Admin/TemplatePhoto/inactive'; theform.submit(); return true;" type="button">
									<input name="active" value=" Active" onclick="javascript: var theform = document.frmForm; theform.action = '<{$APPLICATION_URL}>/Admin/TemplatePhoto/active'; theform.submit(); return true;" type="button">
								</div>
							</td>
						</tr>
					</tbody>
				</table>
		</div>
	</div>
</div>
</form>